package ru.aptu.gsp_banking.dao_impl;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import ru.aptu.gsp_banking.dao.CurrencyDAO;
import ru.aptu.gsp_banking.domain.Currency;
import ru.aptu.gsp_banking.domain.CurrencyInfo;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * Created by IntelliJ IDEA.
 * User: alex
 * Date: 12/21/11
 * Time: 2:51 PM
 */

@Repository
public class CurrencyDAOImpl implements CurrencyDAO {

    @Autowired
    private SessionFactory sessionFactory;

    public List<Currency> listCurrency() {
        return (List<Currency>) sessionFactory.getCurrentSession().createQuery("from Currency").list();
    }

    public void updateCurrency(Currency currency) {
        sessionFactory.getCurrentSession().update(currency);
    }
}
